<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:form id="frm2">
        <p:commandButton process="@this" value="add new Generated target" action="#{step6Bean.doAddNewGenTarget}" update="@Form" />

        <script type="text/javascript">  
                function takeMyTargetValue(tmplt,id,filename,generatTo) {  
            //  alert(tmplt);
                document.getElementById("mainForm:frm2:GeneratedTargetIDHidden").value=id;
                document.getElementById("mainForm:frm2:GeneratedTargetTemplateHidden").value=tmplt;
                document.getElementById("mainForm:frm2:GeneratedTargetFileNameHidden").value=filename;
                document.getElementById("mainForm:frm2:GeneratedTargetGenerateToHidden").value=generatTo;
                remoteCMDUpdateGeneratedTarget();
                }  
        </script> 

        <h:inputHidden id="GeneratedTargetTemplateHidden" value="#{step6Bean.generatedTargetsTable.template}"/>
        <h:inputHidden id="GeneratedTargetIDHidden" value="#{step6Bean.generatedTargetsTable.ID}"/>
        <h:inputHidden id="GeneratedTargetFileNameHidden" value="#{step6Bean.generatedTargetsTable.filePreName}"/>
        <h:inputHidden id="GeneratedTargetGenerateToHidden" value="#{step6Bean.generatedTargetsTable.generateTo}"/>


        <p:remoteCommand name="remoteCMDUpdateGeneratedTarget" action="#{step6Bean.updateGeneratedTarget}" 
                         process="@this,GeneratedTargetGenerateToHidden, GeneratedTargetFileNameHidden, GeneratedTargetTemplateHidden, GeneratedTargetIDHidden" update="list_growl"/>
        <h:outputText value="Project Path Root: " /><h:inputText id="generateToRoot_Txt" value="#{step6Bean.generateToRoot}" style="width: 500px" title="specify a project root"/>

        <p:dataTable id="yuu" var="info" value="#{step6Bean.generatedTargetsTables}" paginator="true" rows="10" 
                     selection="#{step6Bean.selectedGeneratedTargetsTables}">

            <f:facet name="header">
                Checkbox Based Selection
            </f:facet>

            <p:column selectionMode="multiple" />

            <p:column headerText="ID">
                <h:outputText value="#{info.ID}" />
            </p:column>

            <p:column headerText="File Name">
                <h:inputText style="width: 250px" id="par1" value="#{info.filePreName}" onblur="takeMyTargetValue(null,#{info.ID},this.value,null);" />
            </p:column>
            <p:column headerText="Template">
                <h:inputText style="width: 250px" id="par2" value="#{info.template}" onblur="takeMyTargetValue(this.value,#{info.ID},null,null);"  />
            </p:column>
            <p:column headerText="Generate To">
                <h:inputText style="width: 250px" id="par3"  value="#{info.generateTo}" onblur="takeMyTargetValue(null,#{info.ID},null,this.value);"  />
            </p:column>


            <f:facet name="footer">
                <p:commandButton value="View" image="ui-icon ui-icon-search" process="mainForm:frm2"
                                 update="mainForm:frm2:displayMulti" oncomplete="multiCarDialog.show()"/>
            </f:facet>
        </p:dataTable>


        <p:dialog header="Car Detail" widgetVar="multiCarDialog"  
                  width="250" height="300" showEffect="explode" hideEffect="explode">  

            <p:dataList id="displayMulti"  
                        value="#{step6Bean.selectedGeneratedTargetsTables}" var="selectedTbl">  

                ID: #{selectedTbl.ID}, filePostName: #{selectedTbl.filePostName}  
            </p:dataList>  

        </p:dialog>  

    </h:form>

    <h:form id="frm3">

        <p:dataTable  id="pyuu" var="info" value="#{step6Bean.dataModelObjectTables}" paginator="true" rows="10"
                      selection="#{step6Bean.selectedObjectsTables}">

            <f:facet name="header">
                Checkbox Based Selection
            </f:facet>

            <p:column selectionMode="multiple" />

            <p:column headerText="ID">
                <h:outputText id="dt1_clmn1" value="#{info.ID}" />
            </p:column>
            <p:column headerText="Code">
                <h:outputText id="dt1_clmn2" value="#{info.code}" />
            </p:column>


            <f:facet name="footer">
                <p:commandButton value="View" process="mainForm:frm3" image="ui-icon ui-icon-search"
                                 update="mainForm:frm3:joo" oncomplete="DMPDialog.show()"/>
            </f:facet>
        </p:dataTable>


        <p:dialog header="DMPDialog" widgetVar="DMPDialog"  
                  width="250" height="300" showEffect="explode" hideEffect="explode">  

            <p:dataList id="joo"  
                        value="#{step6Bean.selectedObjectsTables}" var="selectedDMObj">  

                ID: #{selectedDMObj.ID}, Code: #{selectedDMObj.code}  
            </p:dataList>  

        </p:dialog>  

        <p:commandButton process="@form,mainForm:frm2:generateToRoot_Txt" value="generate" action="#{step6Bean.doTempleting}" />
    </h:form>

</html>

